package com.epoint.mobileoa.bizlogic.mobileoa;

import java.io.File;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

import android.os.Message;

import com.epoint.mobileoa.bizlogic.SuperView;
import com.epoint.mobileoa.bizlogic.Task;
import com.epoint.mobileoa.http.HttpHelp;

/**
 * @author liyc
 * @time 2012-4-12 上午10:14:37
 * @annotation 
 */
public class SendMailWithAttachTask extends Task {

	public SendMailWithAttachTask(SuperView con, HashMap<String, Object> param) {
		super(con, param);
	}

	@Override
	public void exectue(Message mess) throws Exception {
		String mailguid = UUID.randomUUID().toString();
		Map<String, String> mailmap = new HashMap<String, String>();
		mailmap.put("userguid", getCon().fp.getUserguid());
		mailmap.put("mailguid", mailguid);
		mailmap.put("mailtitle", getParam().get("mailtitle").toString());
		mailmap.put("mailcontent", getParam().get("mailcontent").toString());
		mailmap.put("sjrnames", getParam().get("sjrnames").toString());
		mailmap.put("sjrguids", getParam().get("sjrguids").toString());
		mailmap.put("csrnames", getParam().get("csrnames").toString());
		mailmap.put("csrguids", getParam().get("csrguids").toString());
		mailmap.put("hasattach", "1");
		
		Map<String, File> files = (Map<String, File>) getParam().get("attaches");
		
		String seamurl = getCon().fp.getSeamurl()+"?requestType=SendMailWithAttach";
		String bs = HttpHelp.post(seamurl, mailmap, files);
		setMessageToRefreshUI(mess,getCon(), bs);
	}

}
